from pydantic import BaseModel, EmailStr, Field
from typing import Optional, List
from app.schemas.item import ItemResponse


class UserCreate(BaseModel):
    name: str = Field(..., min_length=1, max_length=50)
    email: EmailStr


class UserUpdate(UserCreate):
    pass


class UserResponse(BaseModel):
   id: int
   name: str
   email: EmailStr
   items: List[ItemResponse] = []

   class Config:
      from_attributes = True